﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using SymbolIntegration.core.Helpers;

namespace SymbolIntegration.test
{
    [TestFixture]
    public class MathHelperTests
    {
        [TestCase(1.0, 1.0f)]
        [TestCase(12.0, 12.0f)]
        [TestCase(-21.0, -21.0f)]
        [TestCase(1.0, 0.99999999999999f)]
        [TestCase((12.0 * 3.0 )/ 3.0, 12)]
        [TestCase(-21.0 / 7, -3)]
        [Test]
        public void AlmostEqualTrue_Test(double first, double last)
        {
            Assert.IsTrue(MathHelper.AlmostEqual(first, last));
        }

        [TestCase(1.0, -1.0f)]
        [TestCase(10 / 3, 10 / 3.1)]
        [TestCase(-21.0, -21.0f - 0.1)]
        [TestCase(1.0, (int)0.9999f)]
        [TestCase((12.0 * 3.0) / 3.0, 11)]
        [TestCase(-22.0 / 7, -3)]
        [Test]
        public void AlmostEqualFalse_Test(double first, double last)
        {
            Assert.IsFalse(MathHelper.AlmostEqual(first, last));
        }


        [TestCase(-21.0 / 7)]
        [TestCase(-21.0f / 7.0)]
        [TestCase(27.9 / 3.1)]
        [Test]
        public void IsIntegerTrue_Test(double first)
        {
            Assert.IsTrue(MathHelper.IsInteger(first));
        }

        [TestCase(-12 / 7.0)]
        [TestCase(-21.09f / 7.0)]
        [TestCase(27.909 / 3.1)]
        [Test]
        public void IsIntegerFalse_Test(double first)
        {
            Assert.IsFalse(MathHelper.IsInteger(first));
        }
    }
}
